package cn.edu.seu.ssny.service;


import cn.edu.seu.ssny.entity.*;
import cn.edu.seu.ssny.service.support.IBaseService;

import java.util.Date;
import java.util.List;
import java.util.Optional;

public interface IDeviceDataService extends IBaseService<DeviceData,Integer> {
    Optional<DeviceData> findFirstByDeviceOrderByCreateTimeDesc(Device device);

    Optional<DeviceData> findFirstByDeviceAndCreateTimeGreaterThanEqualOrderByCreateTimeAsc(Device device, Date createTime);

    Optional<DeviceData> findFirstByDeviceAndCreateTimeLessThanEqualOrderByCreateTimeDesc(Device device, Date createTime);

    Optional<DeviceData> findFirstByDeviceAndCreateTimeBetweenOrderByCreateTimeAsc(Device device, Date start, Date end);

    List<DeviceData> findAllByDeviceAndCreateTimeBetweenOrderByCreateTimeAsc(Device device, Date start, Date end);

    void saveOrModify(DeviceData deviceData, Device device);

    void newDataProcess(Device device, Date datetime, double data);

    Date getRoundTime(DeviceData deviceData);


}

